<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>味正商城</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" type="text/css" href="/resource/front/dist/css/lib/sm.css">
    <link rel="stylesheet" type="text/css" href="/resource/front/dist/css/lib/sm-extend.css">
    <link rel="stylesheet" type="text/css" href="/resource/front/dist/css/module.css">
    <link rel="stylesheet" type="text/css" href="/resource/front/dist/css/base.css">
    <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_561750_exl4mqccam8l4n29.css">

</head>

<body>
<div class="page-group">
    <div class="page">
        <!--头部内容 !-->
        <header >
            <h1 class="title xl white">招商加盟</h1>
            <div class="underline"></div>
        </header>
        <div class="wrapper">
            <div class="joinhead"></div>
           <div class="joinInf">
               <ul class="underline  white">
                   <li class="joinItem flex">
                       <div class="xl jointext">联系人</div>
                       <input class="name hui l mr10 cell-main" type="text" placeholder="请填写联系人信息" >
                   </li>
               </ul>
               <ul class="underline  white">
                   <li class="joinItem flex">
                       <div class="xl jointext">联系电话</div>
                       <input class="tel hui l mr10 cell-main" type="number" placeholder="请填写联系电话" >
                   </li>
               </ul>
               <ul class="underline  white">
                   <li class="joinItem flex">
                       <div class="xl jointext">所在地区</div>
                       <input class="addr hui l mr10 cell-main right" type="text"  placeholder="请选择所在地区" id='city-picker'>
                       <i class="iconfont icon-more1 xl hui"></i>
                   </li>
               </ul>
               <div class="joinBtn center auto xl">确定</div>
           </div>
        </div>
    </div>
</div>
<script type='text/javascript' src='/resource/front/dist/js/lib/zepto.js' charset='utf-8'></script>
<script>
    $.config = {
        router: false
    }
</script>
<script type='text/javascript' src='/resource/front/dist/js/lib/sm.js' charset='utf-8'></script>
<script type='text/javascript' src='/resource/front/dist/js/lib/sm-extend.js' charset='utf-8'></script>
<script type="text/javascript" src="//g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js" charset="utf-8"></script>
<script>
    $.init();
    $("#city-picker").cityPicker({
        toolbarTemplate: '<header class="bar bar-nav"><button class="button button-link pull-right close-picker xl mr10">确定</button><h1 class="title xl">选择收货地址</h1></header>'
    });
    $('.joinBtn').click(function () {
        var obj={
            name:$('.name').val(),
            phone:$('.tel').val(),
            address:$('.addr').val()
        },  reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if(!obj.phone||!obj.name||!obj.address){
            $.toast('请填写完整信息');
            return false;
        }else{
            reg.test(obj.phone) ?  submitJoin(obj) : $.toast('手机格式不正确')
        }
    })
    function submitJoin(obj) {
        $.ajax({
            type:'POST',
            url:'/rest/front/joinus/insertJson',
            data:obj,
            dataType:'json',
            success:function () {
                $.toast("提交成功");
                window.location.reload()
            }
        })
    }
</script>
</body>
</html>
